<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // reflect 映射
        let obj = {
            name:'wushuo',
            msg:'都精神精神'
        }
        let proxy = new Proxy(obj,{
            get(target,key,receiver){
                console.log(target);
                // return target[key]
                console.log(Reflect);
                // return target[key];
                return Reflect.get(target,key,receiver);
            },
            set(target,key,value,receiver){
                console.log(target);
                // 
                console.log(Reflect.set(target,key,value,receiver));
                

            }
        }) 
        console.log(proxy.name);//获取 undefined
        proxy.name = 'hanweichen';
// Object.defineProperty

        /*
        Object.defineProperty
        proxy 数据代理

        proxy可以直接监听对象而非属性，它即可以监听对象也可以监听数组
        Object.defineProperty  监听的是对象中的属性，故而只能监听对象，不能监听数组

        
        proxy有很多种数据拦截的方式 get set apply ownKeys defineProperty...
        proxy作为一个新标准 受浏览器厂商重点优化 
        Object.defineProperty兼容性好 支持IE9


        
        
        
        */
    </script>
</body>
</html>